package cn.iocoder.yudao.module.biz.dal.mysql.safetyCheck.mapper;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.safetyCheck.BizSafetyCheckDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.safetyCheck.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 安全检查 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizSafetyCheckMapper extends BaseMapperX<BizSafetyCheckDO> {

    default PageResult<BizSafetyCheckDO> selectPage(BizSafetyCheckPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizSafetyCheckDO>()
                .eqIfPresent(BizSafetyCheckDO::getCheckDeptId, reqVO.getCheckDeptId())
                .eqIfPresent(BizSafetyCheckDO::getCheckbyDeptId, reqVO.getCheckbyDeptId())
                .eqIfPresent(BizSafetyCheckDO::getCheckProject, reqVO.getCheckProject())
                .betweenIfPresent(BizSafetyCheckDO::getCheckTime, reqVO.getBeginCheckTime(), reqVO.getEndCheckTime())
                .eqIfPresent(BizSafetyCheckDO::getCheckUserId, reqVO.getCheckUserId())
                .eqIfPresent(BizSafetyCheckDO::getCheckFileId, reqVO.getCheckFileId())
                .betweenIfPresent(BizSafetyCheckDO::getRecheckTime, reqVO.getBeginRecheckTime(), reqVO.getEndRecheckTime())
                .eqIfPresent(BizSafetyCheckDO::getRectificationCompletion, reqVO.getRectificationCompletion())
                .eqIfPresent(BizSafetyCheckDO::getRectificationImageId, reqVO.getRectificationImageId())
                .eqIfPresent(BizSafetyCheckDO::getRectificationFileId, reqVO.getRectificationFileId())
                .betweenIfPresent(BizSafetyCheckDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizSafetyCheckDO::getId));
    }

    default List<BizSafetyCheckDO> selectList(BizSafetyCheckExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizSafetyCheckDO>()
                .eqIfPresent(BizSafetyCheckDO::getCheckDeptId, reqVO.getCheckDeptId())
                .eqIfPresent(BizSafetyCheckDO::getCheckbyDeptId, reqVO.getCheckbyDeptId())
                .eqIfPresent(BizSafetyCheckDO::getCheckProject, reqVO.getCheckProject())
                .betweenIfPresent(BizSafetyCheckDO::getCheckTime, reqVO.getBeginCheckTime(), reqVO.getEndCheckTime())
                .eqIfPresent(BizSafetyCheckDO::getCheckUserId, reqVO.getCheckUserId())
                .eqIfPresent(BizSafetyCheckDO::getCheckFileId, reqVO.getCheckFileId())
                .betweenIfPresent(BizSafetyCheckDO::getRecheckTime, reqVO.getBeginRecheckTime(), reqVO.getEndRecheckTime())
                .eqIfPresent(BizSafetyCheckDO::getRectificationCompletion, reqVO.getRectificationCompletion())
                .eqIfPresent(BizSafetyCheckDO::getRectificationImageId, reqVO.getRectificationImageId())
                .eqIfPresent(BizSafetyCheckDO::getRectificationFileId, reqVO.getRectificationFileId())
                .betweenIfPresent(BizSafetyCheckDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizSafetyCheckDO::getId));
    }

    List<BizSafetyCheckPageJoinVO> selectSafetyCheck(BizSafetyCheckPageReqVO pageVO);

    Integer selectSafetyCheckCount(BizSafetyCheckPageReqVO pageVO);

}
